//
//  ActivateBorrowView.m
//  WBBaseProject
//  
//  Created by 吴斌 on 2018/3/5.
//  Copyright © 2018年 吴斌. All rights reserved.
//

#import "ActivateBorrowView.h"
#import "BorrowMoneyTwoView.h"
#import "BorrowMoneyThreeView.h"
#import "BorrowMoneyFourView.h"
#import <UIImage+GIF.h>
@implementation ActivateBorrowView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    UIImageView *blueBg = [[UIImageView alloc] init];
    blueBg.image = WB_ImageName(@"首页蓝色背景");
    [self addSubview:blueBg];
    [blueBg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.right.left.equalTo(0);
        make.bottom.equalTo(-64);
    }];
    
    _whiteBg = [[UIImageView alloc] init];
    _whiteBg.image = WB_ImageName(@"首页白色背景");
    _whiteBg.userInteractionEnabled = YES;

    [self addSubview:_whiteBg];
    [_whiteBg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(15);
        make.right.equalTo(-15);
        make.top.equalTo(64 + kIPhoneXMoreHeight);
        make.bottom.equalTo(0);
    }];
    
    _InfoView = [[NSBundle mainBundle] loadNibNamed:@"BorrowMoneyView" owner:self options:nil].firstObject;
    _InfoView.backgroundColor = [UIColor clearColor];
    [_InfoView.immediateActiveBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
    
    [_whiteBg addSubview:_InfoView];
    [_InfoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(0);
    }];
    
    
//    BorrowMoneyFourView *InfoView = [[NSBundle mainBundle] loadNibNamed:@"BorrowMoneyFourView" owner:self options:nil].firstObject;
//    InfoView.backgroundColor = [UIColor clearColor];
//    
////    NSString  *name = @"u246.gif";  
//    NSString *path = [[NSBundle mainBundle] pathForResource:@"u246" ofType:@"gif"];
//    NSURL *url = [NSURL URLWithString:path];
//    [InfoView.gitImageWebView loadRequest:[NSURLRequest requestWithURL:url]];  
//    
//    [whiteBg addSubview:InfoView];
//    [InfoView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.edges.equalTo(0);
//    }];
}

- (void)click:(UIButton *)sender
{
    if (self.delegate && [self.delegate respondsToSelector:@selector(clickBorrowView:button:)]) {
        [self.delegate clickBorrowView:self button:sender];
    }
}

@end
